package com.hut.oa.model.bean;

import static org.mockito.Mockito.CALLS_REAL_METHODS;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import net.minidev.json.annotate.JsonIgnore;

/**
 * 任务管理表
 * @author 熊涛
 *
 */
@Entity
@Table(name="task_manage")
public class TaskManage {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="tm_id")
	private Long tmId;//任务管理表id
	
	@Column(name="tm_start_time",nullable=false)
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date tmStartTime;//任务开始时间
	
	@Column(name="tm_end_time",nullable=false)
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date tmEndTime;//任务结束时间
	
	@Column(name="tm_status")
	private Long tmStatus=2l;//任务状态
	
	@Column(name="tm_type",nullable=false)
	private Long type=1l;//任务类型
	
	@Column(name="tm_finishrequre")
	private String finishrequre;//完成标准
	
	@ManyToOne()
	@JsonIgnore
	@JoinColumn(name="u_id",nullable=false)	
	private User user;//发布人id
	
	@Column(name="tm_title",nullable=false)
	private String tmTitle;//任务主题
	
	@Column(name="tm_content")
	private String tmContent;//任务内容
	
	@Column(name="tm_progress")
	private Integer tmProgress=0;//任务进度
	
	@Column(name="tm_push_time")
	private Date tmPushTime;//任务发布时间
	
	@Column(name="tm_is_delete",nullable=false)
	private Integer tmIsDelete=0;//是否放入回收站
	
	@Column(name="att_id",nullable=false)
	private Long attid=0l;//附件id

	@OneToMany(mappedBy="task",cascade=CascadeType.ALL)
	@JsonIgnore
	private List<TaskUser> taskuser;
	
	@OneToMany(mappedBy="task",cascade=CascadeType.ALL)
	@JsonIgnore
	private List<TaskFeedback> tfback;
	
	public TaskManage() {
		// TODO Auto-generated constructor stub
	}
	public Long getTmId() {
		return tmId;
	}

	public void setTmId(Long tmId) {
		this.tmId = tmId;
	}

	public Date getTmStartTime() {
		return tmStartTime;
	}

	public void setTmStartTime(Date tmStartTime) {
		this.tmStartTime = tmStartTime;
	}

	public Date getTmEndTime() {
		return tmEndTime;
	}

	public void setTmEndTime(Date tmEndTime) {
		this.tmEndTime = tmEndTime;
	}

	public Long getTmStatus() {
		return tmStatus;
	}

	public void setTmStatus(Long tmStatus) {
		this.tmStatus = tmStatus;
	}


	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getTmTitle() {
		return tmTitle;
	}

	public void setTmTitle(String tmTitle) {
		this.tmTitle = tmTitle;
	}

	public String getTmContent() {
		return tmContent;
	}

	public void setTmContent(String tmContent) {
		this.tmContent = tmContent;
	}

	public Integer getTmProgress() {
		return tmProgress;
	}

	public void setTmProgress(Integer tmProgress) {
		this.tmProgress = tmProgress;
	}

	public Date getTmPushTime() {
		return tmPushTime;
	}

	public void setTmPushTime(Date tmPushTime) {
		this.tmPushTime = tmPushTime;
	}

	public Integer getTmIsDelete() {
		return tmIsDelete;
	}

	public void setTmIsDelete(Integer tmIsDelete) {
		this.tmIsDelete = tmIsDelete;
	}
	public Long getType() {
		return type;
	}

	public void setType(Long type) {
		this.type = type;
	}
	
	public Long getAttid() {
		return attid;
	}

	public void setAttid(Long attid) {
		this.attid = attid;
	}

	public String getFinishrequre() {
		return finishrequre;
	}

	public void setFinishrequre(String finishrequre) {
		this.finishrequre = finishrequre;
	}

	public List<TaskUser> getTaskuser() {
		return taskuser;
	}
	public void setTaskuser(List<TaskUser> taskuser) {
		this.taskuser = taskuser;
	}
	
	public List<TaskFeedback> getTfback() {
		return tfback;
	}
	public void setTfback(List<TaskFeedback> tfback) {
		this.tfback = tfback;
	}
	@Override
	public String toString() {
		return "TaskManage [tmId=" + tmId + ", tmStartTime=" + tmStartTime + ", tmEndTime=" + tmEndTime + ", tmStatus="
				+ tmStatus + ", type=" + type + ", finishrequre=" + finishrequre + ", tmTitle=" + tmTitle
				+ ", tmContent=" + tmContent + ", tmProgress=" + tmProgress + ", tmPushTime=" + tmPushTime
				+ ", tmIsDelete=" + tmIsDelete + ", attid=" + attid + "]";
	}

	
	
	
}
